Skip to content

[6.x] Stop the Playwright server at the end of browser test runs - #20452

Merged
riasvdv merged 1 commit into
6.xfrom
playwright-server-exec-workaround
Nov 7, 2026
Merged

riasvdv merged 1 commit into
6.xfrom
playwright-server-exec-workaround

Conversation

@riasvdv

@riasvdv riasvdv commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Description

pest-plugin-browser 5.2.0 starts the Playwright server with sh -c and no exec. On Linux, dash forks node as a child, so stop() at the end of the run kills the shell and node keeps running:

 php vendor/bin/pest
-└─ sh -c ./node_modules/.bin/playwright run-server …   ← stop() signals this
-   └─ node … run-server                                 ← orphaned, holds Pest's output pipe
+└─ node … run-server                                   ← exec: stop() signals the server itself

Every browser run leaves a server behind, and because node keeps a copy of Pest's output pipe, vendor/bin/pest tests/Browser/… | tail never returns.

tests/Pest.php now creates the plugin's PlaywrightNpmServer with exec in front of the command and stores it in ServerManager, which builds its server with ??= and keeps it. It only applies on non-Windows systems with the plugin at 5.2.0 or earlier, because a fixed release adds its own exec and exec exec fails. Remove it once the upstream fix is released.

Evidence

  • Before: pest tests/Browser/Cp/AuthenticationTest.php | tail -3 hangs (over 2.5 min); an orphaned node … run-server with parent PID 1 holds tail's input pipe. pest --parallel --processes=2 tests/Browser/Cp/Settings: 16 passed, one run-server left running.
    After: the piped run returns in about 15s, 2 of 2 runs, no processes left. The parallel run: 16 passed, no processes left. Unit tests start no server.

Related issues

pest-plugin-browser 5.2.0 starts the server with sh -c and no exec, so
stopping it ends only the shell and leaves node running with a copy of
Pest's output pipe. Start it with exec until a fixed release is out.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1b5f5-1796-77e0-a2fa-5740cad41802
Co-authored-by: Amp <amp@ampcode.com>
@riasvdv
riasvdv requested a review from brandonkelly November 7, 2026 12:48
@riasvdv
riasvdv merged commit 80227b3 into 6.x Nov 7, 2026
17 checks passed
@riasvdv
riasvdv deleted the playwright-server-exec-workaround branch November 7, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants